package collection.homework.List;

import java.util.ArrayList;
import java.util.List;

/**
 * get()
 * set()
 */
public class ListDemo1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        System.out.println("list:"+list);//list:[one, two, three, four]

        String a = list.get(2);
        System.out.println(a);//three

        for (int i =0;i<list.size();i++){
            System.out.println(list.get(i));
        }

        list.set(1,"two2");
        System.out.println("list:"+list);
    }
}
